package com.tianlu.store.service;

import com.tianlu.store.dto.StatusCountDTO;
import com.tianlu.store.dto.TeamPerformanceDTO;
import com.tianlu.store.entity.OrderInfo;
import com.tianlu.store.common.MyBaseService;

import java.math.BigDecimal;
import java.util.List;

/**
 * @Author 梁东烂
 * @Desc 订单表(OrderInfo)表服务接口
 * @Date 2023-04-03 17:06:04
 */
public interface OrderInfoService extends MyBaseService<OrderInfo> {
    /**
     * 修改订单状态
     *
     * @param id     订单id
     * @param status 修改后的状态
     * @return Boolean
     * @author liangdl
     * @since 2023/4/4 11:16
     */
    Boolean updateStatus(Long id, Integer status);

    /**
     * 退款
     *
     * @param id 订单id
     * @return Boolean
     * @author liangdl
     * @since 2023/4/4 11:16
     */
    Boolean drawback(Long id);

    /**
     * 申请退款
     *
     * @param id 订单id
     * @return Boolean
     * @author liangdl
     * @since 2023/4/4 11:16
     */
    Boolean drawbackApplication(Long id);

    /**
     * 发货14天后自动确认收货
     *
     * @author liangdl
     * @since 2023/4/14 11:33
     */
    void autoConfirm();

    /**
     * 手动确认收货
     *
     * @param id 订单id
     * @author liangdl
     * @since 2023/4/26 17:36
     */
    void confirm(Long id);

    /**
     * 根据状态统计数量
     *
     * @param userId 用户id
     * @return List<StatusCountDTO>
     */
    List<StatusCountDTO> countByStatus(Long userId);

    void cancel(Long id);

    void deleteById(Long id);

    /**
     * 查询团队业绩
     *
     * @param userIdList 用户id
     * @return 业绩总额
     * @author liangdl
     * @since 2023/5/4 11:06
     */
    BigDecimal findTeamPerformance(List<Long> userIdList);

    /**
     * 添加秒杀/免费订单表接口
     *
     * @param orderInfo 订单对象
     * @author liangdl
     * @since 2023/5/6 10:44
     */
    void saveKillOrFree(OrderInfo orderInfo);

    /**
     * 按月查询团队业绩
     *
     * @param userIdList 用户id
     * @return 业绩总额
     * @author liangdl
     * @since 2023/5/4 11:06
     */
    List<TeamPerformanceDTO> findPerformanceDetail(List<Long> userIdList);
}
